package com.hgxd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hgxd.entity.pojo.Equipment;

import com.hgxd.mapper.EquipmentMapper;
import com.hgxd.service.IEquipmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 设备表 服务实现类
 * </p>
 *
 * @author fsd
 * @since 2023-10-18
 */
@Service("EquipmentServiceImpl")
public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements IEquipmentService {
    @Resource
    EquipmentMapper equipmentMapper;

    @Override
    public List<Map<String, Object>> getAllOrganization() {
        return equipmentMapper.getAllOrganization();
    }

    @Override
    public Integer getOrganizationOnlineRate() {
        return equipmentMapper.getOrganizationOnlineRate();
    }

    @Override
    public Integer getCountEquipmentType() {
        return equipmentMapper.getCountEquipmentType();
    }

    @Override
    public List<Equipment> getEquipmentsByOrganizationId(Integer organizationId) {
        QueryWrapper<Equipment> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("organization_id", organizationId);
        return equipmentMapper.selectList(queryWrapper);
    }

    @Override
    public List<Equipment> getNewDataByOrganizationName(String organizationName) {
        return equipmentMapper.getNewDataByOrganizationName(organizationName);
    }
}
